#!/bin/bash
# 设置项目的APPID
app_id="springboot-jenkins-test"
# 设置需要关闭的端口
port=9090
# 获取此端口运行的进程PID
pid=`lsof -t -i:$port`
# 判断如果进程号不等于空，关闭进程
if [ ! $pid ];
  then
    echo "${app_id} is closed..."
  else
    kill -9 $pid
    echo "${app_id} has been killed..."
fi